import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
class Cashier {
    Map<Integer,Integer> map=new HashMap<>();
    int n;
    int tmp;
    int discount;
    public Cashier(int n, int discount, int[] products, int[] prices) {
        for(int i=0;i<products.length;i++){
            map.put(products[i],prices[i]);
        }
        this.n=n;
        this.tmp=n;
        this.discount= discount;
    }

    public double getBill(int[] product, int[] amount) {
        double count=0;
        for(int i=0;i<product.length;i++){
            count+=map.get(product[i])*amount[i];
        }
        n--;
        if(this.n==0){
            count-=count*(this.discount*0.01);
            n=tmp;
        }
        return count;
    }
}
public class project {
    public int numberOfSets(int n, int k) {
        long[][] dp=new long[n][k+1];
        long[][] dpTmp=new long[n][k+1];

        for(int i=0;i<n;i++){
            dp[i][0]=1;
        }

        for(int i=1;i<k+1;i++){
            for(int j=i;j<n;j++){
                dpTmp[j][i]=dp[j-1][i-1]+dpTmp[j-1][i];
                dp[j][i]=(dpTmp[j][i]+dp[j-1][i])%1000000007;
            }
        }
        return (int)dp[n-1][k];
    }



















    public int[] numMovesStonesII(int[] stones) {
        Arrays.sort(stones);
        int len=stones.length;
        int max=(stones[len-1]-stones[0]+1-len)-Math.min(stones[len-1]-stones[len-2]-1,stones[1]-stones[0]-1);
        int min=max;
        for(int i=0,j=0;i<len;i++){
            while (j<len-1&&stones[j+1]-stones[i]+1<=len){
                j++;
            }
            int count=len-(j-i+1);
            if(j-i+1==len-1&&stones[j]-stones[i]+1==len-1){
                count=2;
            }
            min=Math.min(count,min);
        }
        return new int[]{min,max};
    }
}
